home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / COMPILER / SATHER / !Sather / Library / Base / test / sa / char < prev    next >
Text File  |  1996-04-09  |  4KB  |  95 lines

  1. ---------------------------> Sather 1.1 source file <--------------------------
  2. -- test_char.sa: 
  3. -- Author: Benedict A. Gomes <gomes@samosa.ICSI.Berkeley.EDU>
  4. -- Copyright (C) 1995, International Computer Science Institute
  5. -- $Id: char_test.sa,v 1.2 1996/04/09 10:04:15 borisv Exp $
  6. --
  7. -- COPYRIGHT NOTICE: This code is provided WITHOUT ANY WARRANTY
  8. -- and is subject to the terms of the SATHER LIBRARY GENERAL PUBLIC
  9. -- LICENSE contained in the file: Sather/Doc/License of the
  10. -- Sather distribution. The license is also available from ICSI,
  11. -- 1947 Center St., Suite 600, Berkeley CA 94704, USA.
  12. -------------------------------------------------------------------
  13. class TEST_CHAR is
  14.    -- Test of `CHAR'.
  15.    
  16.    include TEST;
  17.    
  18.    main is
  19.       -- Test `CHAR'.
  20.       class_name("CHAR");
  21.      -- is_alpha
  22.       test("' '.is_alpha", ' '.is_alpha.str, "false");
  23.       test("'.'.is_alpha", '.'.is_alpha.str, "false");
  24.       test("'1'.is_alpha", '1'.is_alpha.str, "false");
  25.       test("'a'.is_alpha", 'a'.is_alpha.str, "true");
  26.       test("'A'.is_alpha", 'A'.is_alpha.str, "true");
  27.       test("3.char.is_alpha", 3.char.is_alpha.str, "false");
  28.      -- is_upper
  29.       test("' '.is_upper", ' '.is_upper.str, "false");
  30.       test("'.'.is_upper", '.'.is_upper.str, "false");
  31.       test("'1'.is_upper", '1'.is_upper.str, "false");
  32.       test("'a'.is_upper", 'a'.is_upper.str, "false");
  33.       test("'A'.is_upper", 'A'.is_upper.str, "true");
  34.       test("3.char.is_upper", 3.char.is_upper.str, "false");
  35.      -- is_lower
  36.       test("' '.is_lower", ' '.is_lower.str, "false");
  37.       test("'.'.is_lower", '.'.is_lower.str, "false");
  38.       test("'1'.is_lower", '1'.is_lower.str, "false");
  39.       test("'a'.is_lower", 'a'.is_lower.str, "true");
  40.       test("'A'.is_lower", 'A'.is_lower.str, "false");
  41.       test("3.char.is_lower", 3.char.is_lower.str, "false");
  42.      -- is_digit
  43.       test("' '.is_digit", ' '.is_digit.str, "false");
  44.       test("'.'.is_digit", '.'.is_digit.str, "false");
  45.       test("'1'.is_digit", '1'.is_digit.str, "true");
  46.       test("'a'.is_digit", 'a'.is_digit.str, "false");
  47.       test("'A'.is_digit", 'A'.is_digit.str, "false");
  48.       test("3.char.is_digit", 3.char.is_digit.str, "false");
  49.      -- is_alphanum
  50.       test("' '.is_alphanum", ' '.is_alphanum.str, "false");
  51.       test("'.'.is_alphanum", '.'.is_alphanum.str, "false");
  52.       test("'1'.is_alphanum", '1'.is_alphanum.str, "true");
  53.       test("'a'.is_alphanum", 'a'.is_alphanum.str, "true");
  54.       test("'A'.is_alphanum", 'A'.is_alphanum.str, "true");
  55.       test("3.char.is_alphanum", 3.char.is_alphanum.str, "false");      
  56.      -- is_space
  57.       test("' '.is_space", ' '.is_space.str, "true");
  58.       test("'.'.is_space", '.'.is_space.str, "false");
  59.       test("'1'.is_space", '1'.is_space.str, "false");
  60.       test("'a'.is_space", 'a'.is_space.str, "false");
  61.       test("'A'.is_space", 'A'.is_space.str, "false");
  62.       test("3.char.is_space", 3.char.is_space.str, "false");
  63.      -- is_print
  64.       test("' '.is_print", ' '.is_print.str, "true");
  65.       test("'.'.is_print", '.'.is_print.str, "true");
  66.       test("'1'.is_print", '1'.is_print.str, "true");
  67.       test("'a'.is_print", 'a'.is_print.str, "true");
  68.       test("'A'.is_print", 'A'.is_print.str, "true");
  69.       test("3.char.is_print", 3.char.is_print.str, "false");
  70.      -- is_punct
  71.       test("' '.is_punct", ' '.is_punct.str, "false");
  72.       test("'.'.is_punct", '.'.is_punct.str, "true");
  73.       test("'1'.is_punct", '1'.is_punct.str, "false");
  74.       test("'a'.is_punct", 'a'.is_punct.str, "false");
  75.       test("'A'.is_punct", 'A'.is_punct.str, "false");
  76.       test("3.char.is_punct", 3.char.is_punct.str, "false");
  77.      -- is_control
  78.       test("' '.is_control", ' '.is_control.str, "false");
  79.       test("'.'.is_control", '.'.is_control.str, "false");
  80.       test("'1'.is_control", '1'.is_control.str, "false");
  81.       test("'a'.is_control", 'a'.is_control.str, "false");
  82.       test("'A'.is_control", 'A'.is_control.str, "false");
  83.       test("3.char.is_control", 3.char.is_control.str, "true");
  84.      -- other
  85.       test("'a'.int", 'a'.int.str, "97");
  86.       test("'a'.str", 'a'.str, "a");
  87.       test("'a'.upper", 'a'.upper.str, "A");
  88.       test("'A'.lower", 'A'.lower.str, "a");
  89.       finish;
  90.    end; -- char_test
  91.    
  92. end; 
  93.  
  94. -------------------------------------------------------------------
  95.